﻿using BLL;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Utils;

namespace BookM
{
    public partial class HomePage : Form
    {
        public HomePage()
        {
            InitializeComponent();
        }
        #region 对象
        BookManagementBLL bookManagementBLL = new BookManagementBLL();
        private TabPage tbMobile = null;
        private TabPage tbUnion = null;
        #endregion


        private void HomePage_Load(object sender, EventArgs e)
        {

            //图书管理
            AddOption(EnumTools.GetDescription(ManageEnums.BOOK_OPTION.MANAGENENT), "tbunion", new Management());
            //读者管理
            AddOption(EnumTools.GetDescription(ManageEnums.BOOK_OPTION.READER_MANAGENENT), "Reader", new ReaderManagement());
            //借还记录
            AddOption(EnumTools.GetDescription(ManageEnums.BOOK_OPTION.BORROWRETURN), "BookBorrowReturn", new BookBorrowReturn());
            //图书借还
            AddOption(EnumTools.GetDescription(ManageEnums.BOOK_OPTION.RETURNMANAGENENT), "BorrowReturnM", new BorrowReturnM());
        }

        /// <summary>
        /// 添加窗体到选项卡
        /// </summary>
        /// <param name="TabName">选项卡名称</param>
        /// <param name="Name">控件名称</param>
        /// <param name="form">窗体</param>
        private void AddOption(string TabName, string  Name,Form form)
        {
            tbUnion = new TabPage(TabName);
            tbUnion.Name = Name;
            tabCo.Controls.Add(tbUnion);
            form.TopLevel = false;
            form.BackColor = Color.White;
            form.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
            form.FormBorderStyle = FormBorderStyle.None;
            tbUnion.Controls.Add(form);
            //tabCo.SelectedTab = tbMobile;
            form.Show();

        }

    }
}
